package git.bds.nyc.applet.api.controller.mine.corp;

import git.bds.nyc.applet.api.service.release.ReleaseService;
import git.bds.nyc.product.model.dto.ProductDTO;
import git.bds.nyc.product.valid.ValidGroup;
import git.bds.nyc.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 成大事
 * @since 2023/6/10 18:05
 */
@Api(tags = "加工农产品接口管理")
@Slf4j
@Validated
@RestController
@RequestMapping("/applet/mine/processing-product")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ProcessingProductController {

    private final ReleaseService releaseService;



    /**
     * 发布在售初级产品
     *
     * @param productDTO 产品dto
     * @return {@link R}<{@link Object}>
     */
    @ApiOperation("发布加工在售农产品")
    @PostMapping("/releaseOnSellProduct")
    public R<Boolean> releaseOnSellProduct(
            @Validated({ValidGroup.OnSell.class}) @RequestBody ProductDTO productDTO
    ){
        return R.decide(releaseService.releaseProcessingProduct(productDTO));
    }

    //
    ///**
    // * 发布加工预售产品
    // *
    // * @param productDTO 产品dto
    // * @return {@link R}<{@link Boolean}>
    // */
    //@ApiOperation("发布初级预售农产品")
    //@PostMapping("/releasePreSellProduct")
    //public R<Boolean> releasePreSellProduct(
    //        @Validated({ValidGroup.PreSale.class}) @RequestBody ProductDTO productDTO
    //){
    //    return R.decide(releaseService.releaseProduct(productDTO));
    //}



}
